package com.gitee.huanminabc.fastboot.web.classload;

import com.gitee.huanminabc.fastboot.load.classload.ClassLoadIntercept;
import com.gitee.huanminabc.fastboot.web.context.AppWebContext;
import com.gitee.huanminabc.fastboot.web.servlet.HandlerInterceptor;
import com.gitee.huanminabc.jcommon.reflect.ClassUtil;

/**
 * 简要描述
 *
 * @Author: huanmin
 * @Date: 2025/4/13 00:43
 * @Version: 1.0
 * @Description: 文件作用详细描述....
 */
public class HandlerInterceptorClassLoad implements ClassLoadIntercept {
    @Override
    public void peek(Class<?> clazz) throws Exception {
        if (HandlerInterceptor.class.isAssignableFrom(clazz)) {
            Object newInstance = ClassUtil.newInstance(clazz);
            AppWebContext.handlerInterceptors.add((HandlerInterceptor) newInstance);
        }
    }
}
